﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ProtoBuf;

namespace WSServer
{
    public enum WSResponseType
    {
        kWSResponseTypeDidSocketRegistered = 0,
        kWSResponseTypeDidTokenExpired = 1,
        kWSResponseTypeDidTokenRefreshed = 2,
        kWSResponseTypeMessage = 3
    }
    public enum WSResponseStatus
    {
        kWSResponseStatusPendingSend = 0,
        kWSResponseStatusSentButWatingReceip = 1,
        kWSResponseStatusReceipRecved = 2,
        kWSResponseStatusOfflineSaved = 3
    }
    [ProtoContract]
    public class WSResponse
    {
        [ProtoMember(1)]
        public string identifier { get; set; }
        [ProtoMember(2)]
        public WSAccessToken token { get; set; }
        [ProtoMember(3)]
        public WSResponseType type { get; set; }
        [ProtoMember(4)]
        public WSResponseStatus status { get; set; }
        [ProtoMember(5)]
        public string messageId { get; set; }
        [ProtoMember(6)]
        public DateTime timetag { get; set; }
        [ProtoMember(7)]
        public string userinfo { get; set; }
        [ProtoMember(8)]
        public string senderId { get; set; }

        public WSResponse()
        {
            timetag = DateTime.Now;
            status = WSResponseStatus.kWSResponseStatusPendingSend;
        }
    }
}
